#ifndef _CKTHREAD_POOL_H_
#define _CKTHREAD_POOL_H_



#include "CKThread.h"
#include <vector>
#include "CKBlockingQueue.h"

namespace K_Engine
{
	typedef std::string (*popworkCallBack)(void*);
	typedef void  (*resultCallBack)(void*, std::string);

	class CKThreadPool
	{
	private:
		std::vector<CKThread*> m_thread;
		CKBlockingQueue<std::string> m_work;
		int m_nPoolSize;
		std::string strLastError;
		bool bIsStart;
	
	public:
		CKThreadPool();
		bool SetThreadNum(int size);
		bool Start(void* rcb, resultCallBack _resultcallback);
		~CKThreadPool();
		void SetWork(std::string _work);
		std::string strGetLastError() const;
		
	protected:
		std::string GetWork();
		void SetLastError(std::string strError);
	};
}


#endif // ! _CKTHREAD_POOL_H_
